<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
 "http://struts.apache.org/dtds/struts-2.0.dtd">

<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ taglib uri="http://displaytag.sf.net" prefix="display"%>
<%@ taglib prefix="sx" uri="/struts-dojo-tags"%>	

<script type="text/javascript">
	function addAction() {
		// Llamo al action que agrega la accion.
		document.forms[0].action = "MeetingAction_addAction";
  		document.forms[0].submit();
	}
	function addTheme() {
		// Llamo al action que agregar el tema.
		document.forms[0].action = "MeetingAction_addTheme";
  		document.forms[0].submit();
	}
	function removeAction( selectedActionForDelete ) 
	{
		// Guardo el nombre de la accion a eliminar en un campo hidden.
		document.getElementById("selectedActionForDelete").value = selectedActionForDelete;
		// Llamo al action que eliminar la accion.
		document.forms[0].action = "MeetingAction_deleteAction";
  		document.forms[0].submit();
	}	
	function removeTheme( selectedThemeForDelete ) 
	{
		// Guardo el nombre del tema a eliminar en un campo hidden.
		document.getElementById("selectedThemeForDelete").value = selectedThemeForDelete;
		// Llamo al action que eliminar el tema.
		document.forms[0].action = "MeetingAction_deleteTheme";
  		document.forms[0].submit();
	}
</script>

<input type="hidden" id="selectedThemeForDelete" name="selectedThemeForDelete" />
<input type="hidden" id="selectedActionForDelete" name="selectedActionForDelete" />

<!--  Tabla de temas	-->


<table width="67%">
	<tr>
		<td colspan="2">
			<display:table id="themes" name="meeting.noteThemes" defaultsort="1" requestURI="${themesAndActionsMethod}" class="listable" cellpadding="0" cellspacing="0" pagesize="10" >
				<display:column property="name" titleKey="theme.topic" sortable="true" />
				<display:column property="type" titleKey="theme.type" sortable="true" />
				<display:column property="priority" titleKey="theme.priority" sortable="true" />
				<display:column titleKey="options" sortable="false" >
					<a href="javascript:removeTheme('${themes.name}')"><s:text name="theme.remove"/></a>
				</display:column>
			</display:table>
		</td>
	</tr>
</table>

<!--  Seccion para agregar un nuevo tema	-->
<table width="40%">
	<tr>
		<td width="36%" >
			<sx:autocompleter key="theme.new" autoComplete="false"
								showDownArrow="false"
								name="newTopic"
								forceValidOption="false" />
		    </td>
	</tr>
	<tr>
		<td width="36%">
			<sx:autocompleter list="topicTypes" key="theme.type"
								showDownArrow="false" searchType="startword" 
								name="selectedTopicType" keyName="selectedTopicTypeId"
								forceValidOption="true" />
		   </td>
	</tr>
	<tr>
		<td width="36%">
	<sx:autocompleter list="priorityTypes" key="theme.priority"
						showDownArrow="false" searchType="startword" 
						name="selectedPriorityType" keyName="selectedPriorityTypeId"
						forceValidOption="true" />
		    </td>
	</tr>
	<tr>
		<td width="36%">
			<span class="pageLink" style="position:relative; left:520px; top:-60px;" >
				<s:a onclick="addTheme()" cssStyle="cursor:hand"><s:text name="theme.add"/></s:a>
	    	</span>
		</td>
	</tr>
</table>

<!--  Tabla de acciones	-->

<table width="67%">
	<tr>
		<td colspan="2">
			<display:table id="actions" name="meeting.actionsToDo" defaultsort="1" requestURI="${themesAndActionsMethod}" class="listable" cellpadding="0" cellspacing="0" pagesize="10" >
				<display:column property="name" titleKey="action" sortable="true" />
				<display:column titleKey="options" sortable="false" >
					<a href="javascript:removeAction('${actions.name}')"><s:text name="action.remove"/></a>
				</display:column>
			</display:table>
		</td>
	</tr>
</table>

<!--  Seccion para agregar una nueva accion	-->

<table width="40%">
	<tr>
		<td width="36%" >
			<sx:autocompleter id="newAction" key="action.new" autoComplete="false"
								showDownArrow="false"
								name="newAction"
								forceValidOption="false" />
		    </td>
	</tr>
	<tr>
		<td width="36%">
			<span class="pageLink" style="position:relative; left:520px; top:-20px;" >
				<s:a onclick="addAction()" cssStyle="cursor:hand"><s:text name="action.add"/></s:a>
	    	</span>
		</td>
	</tr>
</table>
